package team.xyg.cdtu2.controller;

import team.xyg.cdtu2.dto.PlatMapData;
import team.xyg.cdtu2.dto.PlatformSalesMap;
import team.xyg.cdtu2.entity.PlatformSales;
import team.xyg.cdtu2.service.PlatformSalesService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * (PlatformSales)表控制层
 *
 * @author makejava
 * @since 2022-06-28 08:54:31
 */
@RestController
@RequestMapping("platformSales")
public class PlatformSalesController {
    /**
     * 服务对象
     */
    @Resource
    private PlatformSalesService platformSalesService;




    /**
     * 查询平台销售额的Top4
     * @param topNum
     * @return
     */
    @GetMapping("{topNum}")
    public List<PlatMapData> queryTop(@PathVariable("topNum") Integer topNum){
        return platformSalesService.queryTop(topNum);
    }




    @RequestMapping("map")
    public Map<String,Object> queryplatform_sales(){


        List<PlatformSalesMap> maps = platformSalesService.queryplatform_sales();
        Map<String,Object> result=new HashMap<>();
        result.put("code",200);
        result.put("message","success");
        result.put("data",maps);

        return result;
    }



}

